import os.path
import sys
import time
from telnetlib import EC
from time import sleep
import datetime
import allure
import pytest
from selenium import webdriver
from selenium.webdriver import ActionChains, Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.support.wait import WebDriverWait

from commonDemo.Login_pdm import Login
from commonDemo.common_element import BaseAction
from page.pdm_page import pdmPage
from selenium.webdriver.support import expected_conditions as EC
#  test方法  最后在每个方法最后回到系统主菜单页面，方便后续方法继续测试

from util.conOracle import updateData


@pytest.fixture(scope="module")
@allure.feature("demo")
def driver():
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument("lang=zh-CN.UTF-8")
    driver = webdriver.Remote(command_executor="http://192.168.16.32:5444/wd/hub",
                                   options=chrome_options
                                   )
    driver.implicitly_wait(3)
    # 调用登录

    login = Login(driver)
    login.loginPDM()

    # 执行第 一次 返回driver，当测试方法执行完成后再进入时从这句开始执行，直接执行关闭浏览器
    yield driver
    driver.quit()


@pytest.mark.flaky(reruns=2, reruns_delay=2)
@allure.story(" pdm")
@allure.title("振动分析操作")
def test_01(driver):
    #增加数据库查询设备编号，存在则状态更改为已完成
    updateData("1-BDS-JD-01A", "VT")
    driver.implicitly_wait(10)
    pdm = pdmPage(driver)
    pdm.pdm()    # 点击pdm平台
    driver.maximize_window()
    driver.switch_to.window(driver.window_handles[1])
    pdm.task()  #  点击任务管理
    pdm.add_test_click()  # 点击新增
    sleep(1)
    pdm.add01_click()  # 点击新增-振动分析
    sleep(2)
    pdm.device01_click()#点击第一个设备
    sleep(1)
    pdm.device01_01_click()#点击1-BDS
    sleep(1)
    pdm.device01_02_click()#勾选1-BDS-JD-01A
    pdm.confirm_click()
    pdm.input_WOT_value("WR1212122")
    pdm.addModel_click()
    sleep(1)
    assert pdm.get_assert_text1()=="创建成功"
    pdm.click_task01()
    pdm.input_search_value("1-BDS-JD-01A")  # 查找1-BDS-JD-01A
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.handle_click()
    sleep(2)
    #获取任务编号  后续评估断言是否一致
    mission_text = pdm.get_mission_text()
    pdm.click_time()   #点击数据时间
    sleep(1)
    pdm.click_now_time()   #选择此刻
    sleep(2)
    #滚动
    # actions = ActionChains(driver)
    # actions.send_keys(Keys.PAGE_DOWN).perform()
    pdm.click_wear_index()  # 点击检测设备
    sleep(2)
    pdm.select_option("test")  # 选择检测设备
    sleep(2)
    pdm.click_pollution_index()  # 点击检测探头
    sleep(1)
    pdm.select_option("test0001")  # 选择检测探头
    sleep(1)
    pdm.remarks_input("test")
    pdm.input_measured_value("123")
    pdm.click_submit()    #提交
    sleep(1)
    pdm.click_submit_2()   #数据不完全，二次确认提交
    sleep(1)
    assert pdm.get_assert_text2() == "提交成功"
    # 再次查找1-BDS-JD-01A
    pdm.search_click()   #输入框已有内容，直接点击搜索
    sleep(1)
    pdm.handle_click()
    sleep(2)
    assert pdm.get_mission_text() == mission_text   #断言任务编号，预期值为mission_text
    # 滚动
    pdm.roll_down1()   #滚动到处理建议
    sleep(1)
    pdm.evaluate_click()
    sleep(2)
    # 等待下拉选项出现并选择选项
    pdm.select_option("可接受")
    pdm.input_evaluate_advice("测试通过")
    pdm.input_handle_advice("测试通过")
    pdm.click_submit()    #提交
    sleep(1)
    pdm.click_submit_2()   #二次确认提交
    sleep(1)
    assert pdm.get_assert_text2() == "提交成功"
    sleep(2)
    #点击历史任务
    pdm.history()
    #直接通过唯一值mission_text任务编号查找
    pdm.input_search_value(mission_text)
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.detaile_click()   #详情
    sleep(3)
    #断言设备编号是否是1-BDS-JD-01A   测量数值是否为123
    assert pdm.get_device_text()=="1-BDS-JD-01A"
    assert pdm.get_measure_text()=="123.0"
    #删除任务
    pdm.delete_click()
    sleep(1)
    pdm.confirm01_click()
    sleep(2)
    assert pdm.get_assert_text3() == "删除成功"
    #方便后续测试
    # pdm.click_tab()   #返回首页
    # pdm.pdm()    # 点击pdm平台
    # driver.switch_to.window(driver.window_handles[-1])


@pytest.mark.flaky(reruns=2, reruns_delay=2)
@allure.story(" pdm")
@allure.title("红外诊断操作")
def test_02(driver):
    updateData("1-CCS-MP-01A","IT")
    driver.implicitly_wait(10)
    pdm = pdmPage(driver)
    pdm.click_tab()  # 返回首页
    pdm.pdm()  # 点击pdm平台
    driver.maximize_window()
    driver.switch_to.window(driver.window_handles[-1])
    pdm.task()  # 点击任务管理
    pdm.add_test_click()  # 点击新增
    sleep(1)
    pdm.add02_click()  # 点击新增-红外诊断
    pdm.device01_click()  # 点击第一个设备
    sleep(1)
    pdm.device01_01_click()  # 点击1-CCS
    sleep(1)
    pdm.device01_02_click()  # 勾选1-CCS-MP-01A
    pdm.confirm_click()
    pdm.input_WOT_value("WR1212122")
    pdm.addModel_click()
    sleep(1)
    assert pdm.get_assert_text1()=="创建成功"

    pdm.click_task02()
    pdm.input_search_value("1-CCS-MP-01A")  # 查找1-CCS-MP-01A
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.handle_click()
    sleep(2)
    # 获取任务编号  后续评估断言是否一致
    mission_text = pdm.get_mission_text()
    pdm.click_upload_button()
    sleep(2)
    #输入红外数据
    pdm.input_env_tmp(10)
    pdm.input_refected_tmp(20)
    pdm.input_relative_humidity(10)
    pdm.input_distance(100)
    pdm.input_radiation(0.8)
    sleep(2)
    pdm.confirm01_click()
    sleep(1)
    #输入红外数据2
    pdm.click_upload_button2()
    sleep(1)
    pdm.click_alpha()
    pdm.import_file("1号机辅助变220kV开关1B辅助变侧隔离刀闸_01_A相黄色.ir.jpg")
    pdm.confirm01_click()

    pdm.click_time()  # 点击数据时间
    sleep(1)
    pdm.click_now_time()  # 选择此刻
    pdm.remarks_input("test")  #备注
    pdm.click_submit()  # 提交
    sleep(1)
    pdm.click_submit_2()  # 二次确认提交
    sleep(1)
    assert pdm.get_assert_text2() == "提交成功"
    # 再次查找1-CCS-MP-01A
    pdm.search_click()  # 输入框已有内容，直接点击搜索
    sleep(1)
    pdm.handle_click()
    sleep(2)
    assert pdm.get_mission_text() == mission_text  # 断言任务编号，预期值为mission_text
    # 滚动
    pdm.roll_down1()  # 滚动到处理建议
    sleep(1)
    pdm.evaluate_click()
    sleep(2)
    # 等待下拉选项出现并选择选项
    pdm.select_option("可接受")
    pdm.input_evaluate_advice("测试通过")
    pdm.input_handle_advice("测试通过")
    pdm.click_submit()  # 提交
    sleep(1)
    pdm.click_submit_2()  # 二次确认提交
    sleep(1)
    assert pdm.get_assert_text2() == "提交成功"
    sleep(2)
    # 点击历史任务
    pdm.history()
    # 直接通过唯一值mission_text任务编号查找
    pdm.input_search_value(mission_text)
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.detaile_click()  # 详情
    sleep(3)
    # 断言设备编号是否是1-CCS-MP-01A
    assert pdm.get_device_text() == "1-CCS-MP-01A"
    # 删除任务
    pdm.delete_click()
    sleep(1)
    pdm.confirm01_click()
    sleep(2)
    assert pdm.get_assert_text3() == "删除成功"
    # #方便后续测试
    # pdm.click_tab()   #返回首页
    # pdm.pdm()    # 点击pdm平台
    # driver.switch_to.window(driver.window_handles[-1])

@pytest.mark.flaky(reruns=2, reruns_delay=2)
@allure.story(" pdm")
@allure.title("超声检测操作")
def test_03(driver):
    updateData("1-ECS-ES-31","UT")
    driver.implicitly_wait(10)
    pdm = pdmPage(driver)
    pdm.click_tab()  # 返回首页
    pdm.pdm()
    driver.maximize_window()
    driver.switch_to.window(driver.window_handles[-1])
    pdm.task()  # 点击任务管理
    pdm.add_test_click()  # 点击新增
    sleep(1)
    pdm.add03_click()  # 点击新增-超声检测
    pdm.device01_click()  # 点击第一个设备
    sleep(1)
    pdm.device01_01_click()  # 点击1-RCS
    sleep(1)
    pdm.device01_02_click()  # 勾选1-ECS-ES-31
    pdm.confirm_click()
    pdm.input_WOT_value("WR1212122")
    pdm.addModel_click()
    sleep(1)
    assert pdm.get_assert_text1()=="创建成功"
    pdm.click_task03()
    pdm.input_search_value("1-ECS-ES-31")  # 查找1-ECS-ES-31
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.handle_click()
    sleep(2)
    # 获取任务编号  后续评估断言是否一致
    mission_text = pdm.get_mission_text()
    pdm.click_time()  # 点击数据时间
    sleep(1)
    pdm.click_now_time()  # 选择此刻
    # 滚动
    actions = ActionChains(driver)
    actions.send_keys(Keys.PAGE_DOWN).perform()

    pdm.remarks_input("test")
    pdm.input_UL_strength("123")   #输入超声波强度
    sleep(1)
    pdm.input_sensibility("123")    #输入灵敏度
    sleep(1)
    pdm.input_frequency("123")        #输入测量频率

    #上传音频
    file_input = driver.find_element(By.XPATH, "//input[@type='file']")
    current_dir = os.path.dirname(os.path.abspath(__file__))
    file_path = os.path.join(current_dir, "..", "files", "001.wav")
    file_input.send_keys(file_path)
    time.sleep(2)
    pdm.click_submit()  # 提交
    sleep(1)
    assert pdm.get_assert_text2() == "提交成功"
    sleep(1)
    # 再次查找1-ECS-ES-31
    pdm.search_click()  # 输入框已有内容，直接点击搜索
    sleep(1)
    pdm.handle_click()
    sleep(2)
    assert pdm.get_mission_text() == mission_text  # 断言任务编号，预期值为mission_text
    # 滚动
    pdm.roll_down1()  # 滚动到处理建议
    sleep(1)
    pdm.evaluate_click()
    sleep(2)
    # 等待下拉选项出现并选择选项
    pdm.select_option("可接受")

    pdm.input_evaluate_advice("测试通过")
    pdm.input_handle_advice("测试通过")
    pdm.click_submit()  # 提交
    sleep(1)
    pdm.click_submit_2()  # 二次确认提交
    sleep(1)
    assert pdm.get_assert_text2() == "提交成功"
    sleep(2)
    # 点击历史任务
    pdm.history()
    # 直接通过唯一值mission_text任务编号查找
    pdm.input_search_value(mission_text)
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.detaile_click()  # 详情
    sleep(3)
    # 断言设备编号是否是1-ECS-ES-31   测量数值是否为123
    assert pdm.get_device_text() == "1-ECS-ES-31"
    assert pdm.get_measure_text() == "123"
    # 删除任务
    pdm.delete_click()
    sleep(1)
    pdm.confirm01_click()
    sleep(1)
    assert pdm.get_assert_text3() == "删除成功"
    # #方便后续测试
    # pdm.click_tab()   #返回首页
    # pdm.pdm()    # 点击pdm平台
    # driver.switch_to.window(driver.window_handles[-1])


@pytest.mark.flaky(reruns=2, reruns_delay=2)
@allure.story(" pdm")
@allure.title("声学成像操作")
def test_04(driver):
    updateData("1-ZAS-EB-01","UT")
    driver.implicitly_wait(10)
    pdm = pdmPage(driver)
    pdm.click_tab()  # 返回首页
    pdm.pdm()
    driver.maximize_window()
    driver.switch_to.window(driver.window_handles[-1])
    pdm.task()  # 点击任务管理
    pdm.add_test_click()  # 点击新增
    sleep(1)
    pdm.add04_click()  # 点击新增-超声检测
    pdm.device01_click()  # 点击第一个设备
    sleep(1)
    pdm.device01_01_click()  # 点击1-ZAS
    sleep(1)
    pdm.device01_02_click()  # 勾选1-ZAS-EB-01
    pdm.confirm_click()
    pdm.input_WOT_value("WR1212122")
    pdm.addModel_click()
    sleep(1)
    assert pdm.get_assert_text1()=="创建成功"
    pdm.click_task04()
    pdm.input_search_value("1-ZAS-EB-01")  # 查找1-ZAS-EB-01
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.handle_click()
    sleep(2)
    # 获取任务编号  后续评估断言是否一致
    mission_text = pdm.get_mission_text()
    pdm.click_time()  # 点击数据时间
    sleep(1)
    pdm.click_now_time()  # 选择此刻
    pdm.remarks_input("test")
    pdm.click_submit()  # 提交
    sleep(1)
    assert pdm.get_assert_text2() == "提交成功"
    sleep(1)
    # 再次查找1-ECS-ES-31
    pdm.search_click()  # 输入框已有内容，直接点击搜索
    pdm.handle_click()
    sleep(2)
    assert pdm.get_mission_text() == mission_text  # 断言任务编号，预期值为mission_text
    # 滚动
    pdm.roll_down1()  # 滚动到处理建议
    sleep(1)
    pdm.evaluate_click()
    sleep(2)
    # 等待下拉选项出现并选择选项
    pdm.select_option("可接受")

    pdm.input_evaluate_advice("测试通过")
    pdm.input_handle_advice("测试通过")
    pdm.click_submit()  # 提交
    sleep(1)
    pdm.click_submit_2()  # 二次确认提交
    sleep(1)
    assert pdm.get_assert_text2() == "提交成功"
    sleep(2)
    # 点击历史任务
    pdm.history()
    # 直接通过唯一值mission_text任务编号查找
    pdm.input_search_value(mission_text)
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.detaile_click()  # 详情
    sleep(3)
    # 断言设备编号是否是1-ZAS-EB-01
    assert pdm.get_device_text() == "1-ZAS-EB-01"
    # 删除任务
    pdm.delete_click()
    sleep(1)
    pdm.confirm01_click()
    sleep(1)
    assert pdm.get_assert_text3() == "删除成功"
    # #方便后续测试
    # pdm.click_tab()   #返回首页
    # pdm.pdm()    # 点击pdm平台
    # driver.switch_to.window(driver.window_handles[-1])

@pytest.mark.flaky(reruns=2, reruns_delay=2)
@allure.story(" pdm")
@allure.title("润滑分析操作")
def test_05(driver):
    updateData("1-OWS-MP-01A","LT")
    driver.implicitly_wait(10)
    pdm = pdmPage(driver)
    pdm.click_tab()  # 返回首页
    pdm.pdm()
    driver.maximize_window()
    driver.switch_to.window(driver.window_handles[-1])
    pdm.task()  # 点击任务管理
    pdm.add_test_click()  # 点击新增
    sleep(1)
    pdm.add05_click()  # 点击新增-润滑分析
    sleep(1)
    pdm.device01_click()  # 点击第一个设备
    sleep(1)
    pdm.device01_01_click()  # 点击1-OWS
    sleep(1)
    pdm.device01_02_click()  # 勾选1-OWS-MP-01A
    pdm.confirm_click()
    pdm.input_WOT_value("WR1212122")
    pdm.addModel_click()
    sleep(1)
    assert pdm.get_assert_text1()=="创建成功"
    pdm.click_task05()
    pdm.input_search_value("1-OWS-MP-01A")  # 查找1-OWS-MP-01A
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.handle_click()
    sleep(2)
    # 获取任务编号  后续评估断言是否一致
    mission_text = pdm.get_mission_text()
    # 滚动
    actions = ActionChains(driver)
    actions.send_keys(Keys.PAGE_DOWN).perform()
    sleep(1)
    pdm.click_time()  # 点击数据时间
    sleep(1)
    pdm.click_now_time()  # 选择此刻
    pdm.remarks_input("test")
    pdm.input_measured_value("123")
    sleep(1)
    #数据导入
    pdm.click_data()  #点击数据导入
    pdm.evaluate_click()
    sleep(1)
    pdm.select_option("系统默认")  #选择取样点为系统默认
     # 选择报告
    pdm.import_file2("test.pdf")
    sleep(3)
    pdm.confirm_click()
    #报告导入
    pdm.import_file("test.pdf")
    sleep(1)

    pdm.click_submit()  # 提交
    sleep(1)
    pdm.click_submit_2()   #数据不完全，二次确认提交
    sleep(1)
    assert pdm.get_assert_text2() == "提交成功"
    # 再次查找1-OWS-MP-01A
    pdm.search_click()  # 输入框已有内容，直接点击搜索
    pdm.handle_click()
    sleep(2)
    assert pdm.get_mission_text() == mission_text  # 断言任务编号，预期值为mission_text
    # 滚动
    pdm.roll_down1()  # 滚动到处理建议
    sleep(2)
    pdm.click_wear_index()   #点击磨损指标
    sleep(1)
    pdm.select_option("1")    #选择磨损指标
    pdm.click_pollution_index()    #点击污染指标
    sleep(1)
    pdm.select_option("1")    #选择污染指标
    pdm.click_aging_index()    #点击老化指标
    sleep(1)
    pdm.select_option("1")    #选择老化指标
    pdm.click_evaluate_index()    #点击评估指标
    sleep(1)
    # 等待下拉选项出现并选择选项
    pdm.select_option("可接受")    #选择可接受

    pdm.input_evaluate_advice("测试通过")
    pdm.input_handle_advice("测试通过")
    pdm.click_submit()  # 提交
    sleep(1)
    pdm.click_submit_2()  # 二次确认提交
    sleep(2)
    assert pdm.get_assert_text2() == "提交成功"
    # 点击历史任务
    pdm.history()
    # 直接通过唯一值mission_text任务编号查找
    pdm.input_search_value(mission_text)
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.detaile_click()  # 详情
    sleep(3)
    # 断言设备编号是否是1-OWS-MP-01A
    assert pdm.get_device_text() == "1-OWS-MP-01A"
    # 删除任务
    pdm.delete_click()
    sleep(1)
    pdm.confirm01_click()
    sleep(1)
    assert pdm.get_assert_text3() == "删除成功"
    # #方便后续测试
    # pdm.click_tab()   #返回首页
    # pdm.pdm()    # 点击pdm平台
    # driver.switch_to.window(driver.window_handles[-1])


@pytest.mark.flaky(reruns=2, reruns_delay=2)
@allure.story(" pdm")
@allure.title("电机诊断操作")
def test_06(driver):
    updateData("1-CWS-ED-001","MT")
    driver.implicitly_wait(10)
    pdm = pdmPage(driver)
    pdm.click_tab()  # 返回首页
    pdm.pdm()
    driver.maximize_window()
    driver.switch_to.window(driver.window_handles[-1])
    pdm.task()  # 点击任务管理
    pdm.add_test_click()  # 点击新增
    sleep(1)
    pdm.add06_click()  # 点击新增-电机诊断
    sleep(1)
    pdm.device01_click()  # 点击第一个设备
    sleep(1)
    pdm.device01_03_click()  # 点击1-CWS
    sleep(1)
    pdm.device01_02_click()  # 勾选1-CWS-ED-001
    pdm.confirm_click()
    pdm.input_WOT_value("WR1212122")
    pdm.addModel_click()
    sleep(1)
    assert pdm.get_assert_text1()=="创建成功"
    pdm.click_task06()
    pdm.input_search_value("1-CWS-ED-001")  # 查找1-CWS-ED-001
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.handle_click()
    sleep(2)
    # 获取任务编号  后续评估断言是否一致
    mission_text = pdm.get_mission_text()
    # 滚动
    actions = ActionChains(driver)
    actions.send_keys(Keys.PAGE_DOWN).perform()
    sleep(1)
    pdm.click_time()  # 点击数据时间
    sleep(1)
    pdm.click_now_time()  # 选择此刻
    pdm.remarks_input("test")
    pdm.input_measured_value("123")
    pdm.click_submit()  # 提交
    sleep(1)
    assert pdm.get_assert_text2() == "提交成功"
    # 再次查找1-CWS-ED-001
    pdm.search_click()  # 输入框已有内容，直接点击搜索
    sleep(1)
    pdm.handle_click()
    sleep(2)
    assert pdm.get_mission_text() == mission_text  # 断言任务编号，预期值为mission_text
    # 滚动
    pdm.roll_down1()  # 滚动到处理建议
    sleep(2)
    pdm.evaluate_click()
    sleep(1)
    # 等待下拉选项出现并选择选项
    pdm.select_option("可接受")    #选择可接受

    pdm.input_evaluate_advice("测试通过")
    pdm.input_handle_advice("测试通过")
    pdm.click_submit()  # 提交
    sleep(1)
    pdm.click_submit_2()  # 二次确认提交
    sleep(2)
    assert pdm.get_assert_text2() == "提交成功"
    # 点击历史任务
    pdm.history()
    # 直接通过唯一值mission_text任务编号查找
    pdm.input_search_value(mission_text)
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.detaile_click()  # 详情
    sleep(3)
    # 断言设备编号是否是1-CWS-ED-001
    assert pdm.get_device_text() == "1-CWS-ED-001"
    # 删除任务
    pdm.delete_click()
    sleep(1)
    pdm.confirm01_click()
    sleep(1)
    assert pdm.get_assert_text3() == "删除成功"
    # #方便后续测试
    # pdm.click_tab()   #返回首页
    # pdm.pdm()    # 点击pdm平台
    # driver.switch_to.window(driver.window_handles[-1])

@pytest.mark.flaky(reruns=2, reruns_delay=2)
@allure.story(" pdm")
@allure.title("整体评估操作")
def test_07(driver):
    updateData("1-ASS-JE-PT001","OE")
    driver.implicitly_wait(10)
    pdm = pdmPage(driver)
    pdm.click_tab()  # 返回首页
    pdm.pdm()
    driver.maximize_window()
    driver.switch_to.window(driver.window_handles[-1])
    pdm.task()  # 点击任务管理
    pdm.add_test_click()  # 点击新增
    sleep(1)
    pdm.add07_click()  # 点击新增-整体评估
    sleep(1)
    pdm.click_wear_index()
    sleep(1)
    pdm.select_option("1-ASS-JE-PT001")
    sleep(1)
    pdm.click_triggersource()  # 点击触发来源
    sleep(1)
    pdm.select_option("红外诊断")
    pdm.click_aging_index()
    sleep(1)
    pdm.select_option("管理员（admin）")
    sleep(1)
    pdm.addModel_click()
    sleep(1)
    assert pdm.get_assert_text1() == "创建成功"
    pdm.click_task07()
    pdm.input_search_value("1-ASS-JE-PT001")  # 查找1-ASS-JE-PT001
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.handle_click()
    sleep(2)
    # 获取任务编号  后续评估断言是否一致
    mission_text = pdm.get_mission_text()
    # 滚动
    pdm.roll_down()
    sleep(1)
    pdm.evaluate_click()
    sleep(1)
    # 等待下拉选项出现并选择选项
    pdm.select_option("可接受")  # 选择可接受
    sleep(1)
    # 滚动
    actions = ActionChains(driver)
    actions.send_keys(Keys.PAGE_DOWN).perform()
    sleep(1)
    pdm.input_evaluate_advice0("测试通过")
    pdm.input_evaluate_advice("测试通过")
    pdm.click_submit()  # 提交
    sleep(1)
    assert pdm.get_assert_text2() == "提交成功"
    # 再次查找1-ASS-JE-PT001
    pdm.search_click()  # 输入框已有内容，直接点击搜索
    sleep(1)
    pdm.handle_click()
    sleep(2)
    pdm.click_confirm_evaluate()  # 点击确认评估
    sleep(2)
    pdm.click_confirm_only()  # 点击仅确认
    sleep(2)
    pdm.handle_click()
    pdm.confirm_click()  # 确认
    # 点击历史任务
    pdm.history()
    # 直接通过唯一值mission_text任务编号查找
    pdm.input_search_value(mission_text)
    sleep(2)
    pdm.search_click()
    sleep(1)
    pdm.detaile_click()  # 详情
    sleep(3)
    # 断言设备编号是否是1-ASS-JE-PT001
    assert pdm.get_device_text() == "1-ASS-JE-PT001"
    # 删除任务
    pdm.delete_click()
    sleep(1)
    pdm.confirm01_click()
    sleep(1)
    assert pdm.get_assert_text3() == "删除成功"
    # #方便后续测试
    # pdm.click_tab()   #返回首页
    # pdm.pdm()    # 点击pdm平台
    # driver.switch_to.window(driver.window_handles[-1])


#问题：
#1.封装的input方法ele.clear()清除不了元素   （common_element.py）✅
#2.封装的select_option方法无法选择隐藏的元素选项（pdm.page.py）
#3.如果有任务，断言创建成功会有问题，可以加判断没创建成功点击返回
#4.超声图片上传✅
#5.一个失败，底下都失败，  解决：test方法末尾不需要返回首页 ,但是test方法不能单独跑
#6.元素xpath相同，共用了，导致日志描述有些偏差


